package com.gameShare.mappers.misc

import com.gameShare.entity.dto.misc.MessageDto
import org.apache.ibatis.annotations.Param
import java.time.LocalDate

interface MessageMapper {

    fun selectByUserIdAndType(@Param("userId") userId : String,@Param("type") type : Int?) : List<MessageDto>?

    fun insertMessage(
        @Param("sendUserId") sendUserId : String,
        @Param("userId") receiveUserId: String,
        @Param("createTime") createTime : LocalDate,
        @Param("gameId") gameId : String,
        @Param("type") type: Int,
        @Param("content") content : String
    )

    fun updateMessageRead(@Param("userId") userId: String, @Param("messageId") messageId : Int) : Int

    fun updateMessageReadByType(@Param("userId") userId: String, @Param("type") type: Int) : Int

    fun delMessageById(@Param("userId") userId: String, @Param("messageId") messageId: Int) : Int

    fun delMessageByType(@Param("userId") userId: String, @Param("type") type: Int): Int

    fun checkMessageExist(@Param("userId") userId: String, @Param("type") type: Int?, @Param("messageId") messageId: Int?) : Int
}
